/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.recent;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "recent_trade_reportdetail")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RecentTradeReportDetail.findAll", query = "SELECT r FROM RecentTradeReportDetail r"),
    @NamedQuery(name = "RecentTradeReportDetail.findById", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.id = :id"),
    @NamedQuery(name = "RecentTradeReportDetail.findByMsgType", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.msgType = :msgType"),
    @NamedQuery(name = "RecentTradeReportDetail.findByOrderID", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.orderID = :orderID"),
    @NamedQuery(name = "RecentTradeReportDetail.findByReportNo", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.reportNo = :reportNo"),
    @NamedQuery(name = "RecentTradeReportDetail.findByEntrustNo", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.entrustNo = :entrustNo"),
    @NamedQuery(name = "RecentTradeReportDetail.findByEntrustkey", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.entrustkey = :entrustkey"),
    @NamedQuery(name = "RecentTradeReportDetail.findByWorkingQty", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.workingQty = :workingQty"),
    @NamedQuery(name = "RecentTradeReportDetail.findByUnWorkingQty", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.unWorkingQty = :unWorkingQty"),
    @NamedQuery(name = "RecentTradeReportDetail.findByCancelQty", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.cancelQty = :cancelQty"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExeQtyTatol", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exeQtyTatol = :exeQtyTatol"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExePriceAvg", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exePriceAvg = :exePriceAvg"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExeAmountTatol", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exeAmountTatol = :exeAmountTatol"),
    @NamedQuery(name = "RecentTradeReportDetail.findByPrice", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.price = :price"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExexSeq", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exexSeq = :exexSeq"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExeSequenceNo", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exeSequenceNo = :exeSequenceNo"),
    @NamedQuery(name = "RecentTradeReportDetail.findByOutsideExeNo", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.outsideExeNo = :outsideExeNo"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExeQty", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exeQty = :exeQty"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExePrice", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exePrice = :exePrice"),
    @NamedQuery(name = "RecentTradeReportDetail.findByCurrency", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.currency = :currency"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExeAmount", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exeAmount = :exeAmount"),
    @NamedQuery(name = "RecentTradeReportDetail.findByAccountCode", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.accountCode = :accountCode"),
    @NamedQuery(name = "RecentTradeReportDetail.findByMarketCode", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.marketCode = :marketCode"),
    @NamedQuery(name = "RecentTradeReportDetail.findByClassCode", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.classCode = :classCode"),
    @NamedQuery(name = "RecentTradeReportDetail.findByObj", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.obj = :obj"),
    @NamedQuery(name = "RecentTradeReportDetail.findByBs", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.bs = :bs"),
    @NamedQuery(name = "RecentTradeReportDetail.findByOpenClose", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.openClose = :openClose"),
    @NamedQuery(name = "RecentTradeReportDetail.findByHedgeFlag", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.hedgeFlag = :hedgeFlag"),
    @NamedQuery(name = "RecentTradeReportDetail.findByCloseType", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.closeType = :closeType"),
    @NamedQuery(name = "RecentTradeReportDetail.findByExeTime", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.exeTime = :exeTime"),
    @NamedQuery(name = "RecentTradeReportDetail.findByEntrustTime", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.entrustTime = :entrustTime"),
    @NamedQuery(name = "RecentTradeReportDetail.findBySubmitTime", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.submitTime = :submitTime"),
    @NamedQuery(name = "RecentTradeReportDetail.findByTradeDate", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.tradeDate = :tradeDate"),
    @NamedQuery(name = "RecentTradeReportDetail.findByInvestID", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.investID = :investID"),
    @NamedQuery(name = "RecentTradeReportDetail.findByReMark", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.reMark = :reMark"),
    @NamedQuery(name = "RecentTradeReportDetail.findByOwnUserID", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.ownUserID = :ownUserID"),
    @NamedQuery(name = "RecentTradeReportDetail.findByAlterUserID", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.alterUserID = :alterUserID"),
    @NamedQuery(name = "RecentTradeReportDetail.findByCreateTime", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.createTime = :createTime"),
    @NamedQuery(name = "RecentTradeReportDetail.findByTimeStamp", query = "SELECT r FROM RecentTradeReportDetail r WHERE r.timeStamp = :timeStamp")})
public class RecentTradeReportDetail implements Serializable {
	public static byte[] EnCode(RecentTradeReportDetail msg) throws IOException {
		Codec<RecentTradeReportDetail> Lcode = ProtobufProxy.create(RecentTradeReportDetail.class);
		return Lcode.encode(msg);
	}
	public static RecentTradeReportDetail DeCode(byte[] data) throws IOException {
	Codec<RecentTradeReportDetail> Lcode = ProtobufProxy.create(RecentTradeReportDetail.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Long id;
    @Column(name = "MsgType")
    @Protobuf
	private String msgType;
    @Basic(optional = false)
    @Column(name = "OrderID")
    @Protobuf
	private int orderID;
    @Basic(optional = false)
    @Column(name = "ReportNo")
    @Protobuf
	private int reportNo;
    @Lob
    @Column(name = "ReportContent")
    @Protobuf
	private String reportContent;
    @Column(name = "EntrustNo")
    @Protobuf
	private Integer entrustNo;
    @Column(name = "Entrustkey")
    @Protobuf
	private String entrustkey;
    @Column(name = "WorkingQty")
    @Protobuf
	private Integer workingQty;
    @Column(name = "UnWorkingQty")
    @Protobuf
	private Integer unWorkingQty;
    @Column(name = "CancelQty")
    @Protobuf
	private Integer cancelQty;
    @Column(name = "ExeQtyTatol")
    @Protobuf
	private Integer exeQtyTatol;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "ExePriceAvg")
    @Protobuf
	private Float exePriceAvg;
    @Column(name = "ExeAmountTatol")
    @Protobuf
	private Double exeAmountTatol;
    @Column(name = "Price")
    @Protobuf
	private Float price;
    @Basic(optional = false)
    @Column(name = "ExexSeq")
    @Protobuf
	private int exexSeq;
    @Basic(optional = false)
    @Column(name = "ExeSequenceNo")
    @Protobuf
	private int exeSequenceNo;
    @Column(name = "OutsideExeNo")
    @Protobuf
	private String outsideExeNo;
    @Column(name = "ExeQty")
    @Protobuf
	private Integer exeQty;
    @Column(name = "ExePrice")
    @Protobuf
	private Float exePrice;
    @Column(name = "Currency")
    @Protobuf
	private String currency;
    @Column(name = "ExeAmount")
    @Protobuf
	private Float exeAmount;
    @Basic(optional = false)
    @Column(name = "AccountCode")
    @Protobuf
	private String accountCode;
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Column(name = "ClassCode")
    @Protobuf
	private String classCode;
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Column(name = "BS")
    @Protobuf
	private String bs;
    @Column(name = "OpenClose")
    @Protobuf
	private String openClose;
    @Column(name = "HedgeFlag")
    @Protobuf
	private String hedgeFlag;
    @Column(name = "CloseType")
    @Protobuf
	private String closeType;
    @Column(name = "ExeTime")
    @Temporal(TemporalType.TIME)
    private Date exeTime;
	@Protobuf
	private long exeTimeL;
    @Column(name = "EntrustTime")
    @Temporal(TemporalType.TIME)
    private Date entrustTime;
	@Protobuf
	private long entrustTimeL;
    @Column(name = "SubmitTime")
    @Temporal(TemporalType.TIME)
    private Date submitTime;
	@Protobuf
	private long submitTimeL;
    @Basic(optional = false)
    @Column(name = "TradeDate")
    @Temporal(TemporalType.DATE)
    private Date tradeDate;
	@Protobuf
	private long tradeDateL;
    @Column(name = "InvestID")
    @Protobuf
	private String investID;
    @Column(name = "ReMark")
    private String reMark;
	@Protobuf
	private byte[] reMarkBit;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public RecentTradeReportDetail() {
    }

    public RecentTradeReportDetail(Long id) {
        this.id = id;
    }

    public RecentTradeReportDetail(Long id, int orderID, int reportNo, int exexSeq, int exeSequenceNo, String accountCode, Date tradeDate) {
        this.id = id;
        this.orderID = orderID;
        this.reportNo = reportNo;
        this.exexSeq = exexSeq;
        this.exeSequenceNo = exeSequenceNo;
        this.accountCode = accountCode;
        this.tradeDate = tradeDate;
		this.tradeDateL = CodeTool.DateToLong(tradeDate);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMsgType() {
        return msgType;
    }

    public void setMsgType(String msgType) {
        this.msgType = msgType;
    }

    public int getOrderID() {
        return orderID;
    }

    public void setOrderID(int orderID) {
        this.orderID = orderID;
    }

    public int getReportNo() {
        return reportNo;
    }

    public void setReportNo(int reportNo) {
        this.reportNo = reportNo;
    }

    public String getReportContent() {
        return reportContent;
    }

    public void setReportContent(String reportContent) {
        this.reportContent = reportContent;
    }

    public Integer getEntrustNo() {
        return entrustNo;
    }

    public void setEntrustNo(Integer entrustNo) {
        this.entrustNo = entrustNo;
    }

    public String getEntrustkey() {
        return entrustkey;
    }

    public void setEntrustkey(String entrustkey) {
        this.entrustkey = entrustkey;
    }

    public Integer getWorkingQty() {
        return workingQty;
    }

    public void setWorkingQty(Integer workingQty) {
        this.workingQty = workingQty;
    }

    public Integer getUnWorkingQty() {
        return unWorkingQty;
    }

    public void setUnWorkingQty(Integer unWorkingQty) {
        this.unWorkingQty = unWorkingQty;
    }

    public Integer getCancelQty() {
        return cancelQty;
    }

    public void setCancelQty(Integer cancelQty) {
        this.cancelQty = cancelQty;
    }

    public Integer getExeQtyTatol() {
        return exeQtyTatol;
    }

    public void setExeQtyTatol(Integer exeQtyTatol) {
        this.exeQtyTatol = exeQtyTatol;
    }

    public Float getExePriceAvg() {
        return exePriceAvg;
    }

    public void setExePriceAvg(Float exePriceAvg) {
        this.exePriceAvg = exePriceAvg;
    }

    public Double getExeAmountTatol() {
        return exeAmountTatol;
    }

    public void setExeAmountTatol(Double exeAmountTatol) {
        this.exeAmountTatol = exeAmountTatol;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    public int getExexSeq() {
        return exexSeq;
    }

    public void setExexSeq(int exexSeq) {
        this.exexSeq = exexSeq;
    }

    public int getExeSequenceNo() {
        return exeSequenceNo;
    }

    public void setExeSequenceNo(int exeSequenceNo) {
        this.exeSequenceNo = exeSequenceNo;
    }

    public String getOutsideExeNo() {
        return outsideExeNo;
    }

    public void setOutsideExeNo(String outsideExeNo) {
        this.outsideExeNo = outsideExeNo;
    }

    public Integer getExeQty() {
        return exeQty;
    }

    public void setExeQty(Integer exeQty) {
        this.exeQty = exeQty;
    }

    public Float getExePrice() {
        return exePrice;
    }

    public void setExePrice(Float exePrice) {
        this.exePrice = exePrice;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public Float getExeAmount() {
        return exeAmount;
    }

    public void setExeAmount(Float exeAmount) {
        this.exeAmount = exeAmount;
    }

    public String getAccountCode() {
        return accountCode;
    }

    public void setAccountCode(String accountCode) {
        this.accountCode = accountCode;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getClassCode() {
        return classCode;
    }

    public void setClassCode(String classCode) {
        this.classCode = classCode;
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getBs() {
        return bs;
    }

    public void setBs(String bs) {
        this.bs = bs;
    }

    public String getOpenClose() {
        return openClose;
    }

    public void setOpenClose(String openClose) {
        this.openClose = openClose;
    }

    public String getHedgeFlag() {
        return hedgeFlag;
    }

    public void setHedgeFlag(String hedgeFlag) {
        this.hedgeFlag = hedgeFlag;
    }

    public String getCloseType() {
        return closeType;
    }

    public void setCloseType(String closeType) {
        this.closeType = closeType;
    }

    public Date getExeTime() {
        return exeTime;
    }

    public void setExeTime(Date exeTime) {
        this.exeTime = exeTime;
        this.setExeTimeL(CodeTool.DateToLong(exeTime));
    }

    public Date getEntrustTime() {
        return entrustTime;
    }

    public void setEntrustTime(Date entrustTime) {
        this.entrustTime = entrustTime;
		this.setEntrustTimeL(CodeTool.DateToLong(entrustTime));
    }

    public Date getSubmitTime() {
        return submitTime;
    }

    public void setSubmitTime(Date submitTime) {
        this.submitTime = submitTime;
        this.setSubmitTimeL(CodeTool.DateToLong(submitTime));
		this.setSubmitTimeL(CodeTool.DateToLong(submitTime));
    }

    public Date getTradeDate() {
        return tradeDate;
    }

    public void setTradeDate(Date tradeDate) {
        this.tradeDate = tradeDate;
		this.setTradeDateL(CodeTool.DateToLong(tradeDate));
    }

    public String getInvestID() {
        return investID;
    }

    public void setInvestID(String investID) {
        this.investID = investID;
    }

    public String getReMark() {
        return reMark;
    }

    public void setReMark(String reMark) {
        this.reMark = reMark;
		this.setReMarkBit(CodeTool.StringToBit(reMark));
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RecentTradeReportDetail)) {
            return false;
        }
        RecentTradeReportDetail other = (RecentTradeReportDetail) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.recent.RecentTradeReportDetail[ id=" + id + " ]";
    }

    public long getExeTimeL() {
        return exeTimeL;
    }

    public void setExeTimeL(long exeTimeL) {
        this.exeTimeL = exeTimeL;
		this.exeTime = CodeTool.LongToDate(exeTimeL);
    }

    public long getEntrustTimeL() {
        return entrustTimeL;
    }

    public void setEntrustTimeL(long entrustTimeL) {
        this.entrustTimeL = entrustTimeL;
		this.entrustTime = CodeTool.LongToDate(entrustTimeL);
    }

    public long getSubmitTimeL() {
        return submitTimeL;
    }

    public void setSubmitTimeL(long submitTimeL) {
        this.submitTimeL = submitTimeL;
		this.submitTime = CodeTool.LongToDate(submitTimeL);
    }

    public long getTradeDateL() {
        return tradeDateL;
    }

    public void setTradeDateL(long tradeDateL) {
        this.tradeDateL = tradeDateL;
		this.tradeDate = CodeTool.LongToDate(tradeDateL);
    }

    public byte[] getReMarkBit() {
        return reMarkBit;
    }

    public void setReMarkBit(byte[] reMarkBit) {
        this.reMarkBit = reMarkBit;
		this.reMark = CodeTool.BitToString(reMarkBit);
    }
    
}
